package com.src.gossipncook;

import com.src.gossipncook.R;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class ImageAdapterMain extends BaseAdapter {
    private Context mContext;

    public ImageAdapterMain(Context c) {
        mContext = c;
    }

    public int getCount() {
        return mThumbIds.length;
    }

    public Object getItem(int position) {
        return null;
    }

    public long getItemId(int position) {
        return 0;
    }

    // create a new ImageView for each item referenced by the Adapter
    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView imageView;
        if (convertView == null) {  // if it's not recycled, initialize some attributes
            imageView = new ImageView(mContext);
            imageView.setLayoutParams(new GridView.LayoutParams(150, 150));
            imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);            
            imageView.setAdjustViewBounds(true);           
        } else {
            imageView = (ImageView) convertView;           
        }

        imageView.setImageResource(mThumbIds[position]);
        return imageView;
    }

    // references to our images
    private Integer[] mThumbIds = {
            R.drawable.ic_people,R.drawable.ic_nationalenquirer,
            R.drawable.ic_star, R.drawable.ic_lifestyle,
            R.drawable.ic_m, R.drawable.ic_okmag,
            R.drawable.ic_intouch, R.drawable.ic_globe,
            R.drawable.ic_usweekly, R.drawable.ic_cookinglight,
            R.drawable.ic_foodnetwork, R.drawable.ic_foodandwine,
            R.drawable.ic_bon_appetit
    };    
   
}
